package com.im.partchat.ui.activity.more;


import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.im.partchat.App;
import com.im.partchat.R;
import com.im.partchat.adapter.FootBean;
import com.im.partchat.adapter.MyFooterAdapter;
import com.im.partchat.base.BaseActivity;
import com.im.partchat.bean.Department;
import com.im.partchat.db.dao.DeptDao;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;

public class MyFootActivity extends BaseActivity {


    @BindView(R.id.headImage)
    ImageView headImage;
    @BindView(R.id.name)
    TextView name;
    @BindView(R.id.status)
    TextView status;
    @BindView(R.id.address)
    TextView address;
    @BindView(R.id.recyclerView)
    RecyclerView recyclerView;

    List<FootBean> footBeanList=new ArrayList<>();

    private View headLayout;

    @Override
    protected int getLayoutId() {
        return R.layout.activity_my_foot;
    }

    @Override
    protected void initView(@Nullable Bundle savedInstanceState) {
        super.initView(savedInstanceState);
        Department department = DeptDao.getInstance().getDepartment(App.getUserBean().getDeptId());
        Glide.with(MyFootActivity.this)
                .load(App.getUserBean().getHeadUrl())
                .into(headImage);
        name.setText(App.getUserBean().getName());
        address.setText(department.getName());
        headLayout = LayoutInflater.from(App.getApplication()).inflate(R.layout.my_fotter_heater, null, false);
    }

    @Override
    protected void initData() {
        footBeanList.add(new FootBean("2017年7月5日","转入信大捷安党支部","",""));
        footBeanList.add(new FootBean("2016年12月5日","成为正式党员，加入北京大学党支部","查看《预备党员考察表》","查看转正申请书"));
        footBeanList.add(new FootBean("2015年12月5日","成为预备党员","入党介绍人：陆红 葛优","查看《入党志愿书》"));
        footBeanList.add(new FootBean("2015年5月10日","成为发展对象","查看《入党积极分子考察表》",""));
        footBeanList.add(new FootBean("2014年5月10日","成为入党积极分子","查看《入党积极分子考察表》",""));
        footBeanList.add(new FootBean("2013年11月5日","递交入党申请","查看我的入党申请书","查看个人自传"));

        recyclerView.setLayoutManager(new LinearLayoutManager(this));
        MyFooterAdapter myFooterAdapter = new MyFooterAdapter(this, recyclerView, footBeanList);
        myFooterAdapter.addHeaderView(headLayout);
        recyclerView.setAdapter(myFooterAdapter);
    }

    @Override
    public void onLoadDataSuccess(Object o, String flag) {

    }


}
